<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>抢红包</title>

    <link rel="stylesheet" type="text/css" href="/static/js/layui-v2.5.7/layui/css/layui.css">
    <script type="text/javascript" src="/static/js/layui-v2.5.7/layui/layui.js"></script>
    <script type="text/javascript" src="/static/js/myJs.js"></script>


</head>
<body>
<form method="post" action="Redenvelopes">
    <div class="layui-form-item">
        <label class="layui-form-label">红包总金额</label>
        <div class="layui-input-inline">
            <input type="text" name="total_price" required lay-verify="required" placeholder="红包总金额" autocomplete="off"
                   class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">红包数量</label>
        <div class="layui-input-inline">
            <input type="text" name="num" required lay-verify="required" placeholder="红包数量" autocomplete="off"
                   class="layui-input">
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label">最大金额</label>
        <div class="layui-input-inline">
            <input type="number" name="max" required lay-verify="required" placeholder="每个红包的最大金额(最好接近总金额)"
                   autocomplete="off" class="layui-input">
        </div>
    </div>


    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" type="submit">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>

</form>


{if($result)}
<table class="layui-table">
    <colgroup>
    </colgroup>
    <thead>
    <tr>
        <th>抢到的红包</th>
        <th>余额</th>
    </tr>
    </thead>
    <tbody>
    {foreach($result as $key=>$value)}
    <tr>
        <td>{$key}</td>
        <td>{$value}</td>
    </tr>
    </tbody>
    {/foreach}
    </tbody>
</table>

{/if}








<script>

//    $(function () {
//        $.ajax({
//            dataType: "json",
//            url: '/ow_test/Redenvelopes/Redenvelopes',
//            type: 'post',
//            success: function (data) {
//                console.log(data);
//            }
//        })
//    })





</script>

</body>
</html>